#version 460
#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require

#include "../../../../core/shader_std.h"
#include "../../../../core/shader_built_in_functions.h"
#include "../../../../core/shader_color.h"

layout(location = 0) in vec2 inPoint;
layout(location = 1) in uvec2 inUV_Size;
layout(location = 2) in uvec2 inColor_Type;

layout(location = 0) out vec4 vColor;
layout(location = 1) out uint vICO;
layout(location = 2) out uint vDrawType;
layout(location = 3) out float vIntensity;

layout(push_constant, scalar) uniform DRAWPROP_push_constants {
	S_2DICO_PanelAttr const_push;
};

layout(std140, binding = DEF_BINDING_PROJECT) uniform U_Matrix0 {
	mat4 mat_ProjecView;
};

layout(std140, binding = 1, scalar) readonly buffer U_Matrix1 {
	mat3 tranform[];
};




out gl_PerVertex {
	vec4	gl_Position;
	float	gl_PointSize;
};


//vec2 pos[4] = {vec2(10.0, 10.0), vec2(100.0, 10.0), vec2(10.0, 100.0), vec2(100.0, 100.0)};

void main(void){
	mat3 mat = tranform[const_push.m_Offset_Instance + gl_InstanceIndex];

	vec4 v = vec4(mat * vec3(inPoint, 1.0), 1.0);
	gl_Position = mat_ProjecView * v;
	gl_PointSize = inUV_Size.y;
	vICO = inUV_Size.x;

	vIntensity = 1;
	
	vColor = f_glsl_buildColor(inColor_Type.x);
	vDrawType = inColor_Type.y;
	
}



